﻿using System;
using System.Data;
using System.Collections.Generic;
using RealTimePriceFetchService.Model;
namespace RealTimePriceFetchService.BLL
{
    /// <summary>
    /// 业务逻辑类SHAStockCodeBLL 的摘要说明。
    /// </summary>
    public class SHAStockCodeBLL
    {
        private readonly RealTimePriceFetchService.DAL.SHAStockCodeDAL dal = new RealTimePriceFetchService.DAL.SHAStockCodeDAL();
        public SHAStockCodeBLL()
        { }
        #region  成员方法
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return dal.GetList(strWhere);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<RealTimePriceFetchService.Model.SHAStockCodeModel> GetModelList(string strWhere)
        {
            DataSet ds = dal.GetList(strWhere);
            List<RealTimePriceFetchService.Model.SHAStockCodeModel> modelList = new List<RealTimePriceFetchService.Model.SHAStockCodeModel>();
            int rowsCount = ds.Tables[0].Rows.Count;
            if (rowsCount > 0)
            {
                RealTimePriceFetchService.Model.SHAStockCodeModel model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new RealTimePriceFetchService.Model.SHAStockCodeModel();
                    if (ds.Tables[0].Rows[n]["StockCode"].ToString() != "")
                    {
                        model.StockCode = int.Parse(ds.Tables[0].Rows[n]["StockCode"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return modelList;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetAllList()
        {
            return GetList("");
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        //{
        //return dal.GetList(PageSize,PageIndex,strWhere);
        //}

        #endregion  成员方法
    }
}

